package service.impl;

import dao.NewsDao;
import pojo.News;
import service.NewsService;

/**
 * @author 黄军艳
 * @version 1.0
 * @date 2024/11/25  16:02
 */
public class NewsServiceImpl implements NewsService {
    //调用数据访问层接口中的save方法
//    NewsDao dao = new NewsDaoImpl();

    //所依赖的NewsDao对象
//    private NewsDao dao= SimpleDaoFactory.getInstance();

    private NewsDao dao;
    public void setDao(NewsDao dao) {
        this.dao = dao;
    }
    public void addNews(News news) {
        //调用NewsDao的方法保存新闻信息
        dao.save(news);
    }

    @Override
    public void save(News news) {
        dao.save(news);
    }
}
